<?php
/**
 * Created by Engineer CuiLiwu.
 * Project: deal.
 * Date: 2018/5/8-16:41
 * License Hangzhou orce Technology Co., Ltd. Copyright © 2018
 */

namespace App\Http\Controllers\Web\Member\Seller;

use App\Http\Controllers\Web\BaseController;
use Illuminate\Http\Request;
use App\Http\Controllers\Web\UploadController;

class ShopPictureController extends BaseController
{
    protected $api_url = [
        
    ];

    protected $api_host;

    protected $request;

    public function __construct(Request $request)
    {
        $this->request = $request;
        $this->api_host = config('url.api_web');
    }

    public function index(UploadController $images)
    {
        $imagesList = $images->getUserImages($this->request);
        return view('web.user.seller.pictures', ['list'=>$imagesList]);
    }

    public function show($id){}

    public function create(){}

    public function store(){}

    public function edit($id){}

    public function update($id){}

    public function destroy($id,UploadController $images){}
    public function deletePicture(UploadController $images){
        $params = $this->request->only(['id']);
        if (!isset($params['id']) || !$params['id'] ){
            return response()->json(['code'=>false,'message'=>'图片删除失败']);
        }
        $id = $params['id'];
        $id = 'upload/image/'.session('user_id').'/'.$id;
        $delete = $images->deleteObject($id);
        return $delete;
    }
}